from app.utils.ros_utils import ROSUtils

class CabinService:
    def __init__(self, ros_utils):
        self.ros_utils = ros_utils
    
    def process(self):
        """启动索驱处理过程"""
        print("启动索驱处理过程")
        # data = {
            
        # }
        data = ""
        print("暂时不测试")
        pass
        return self.ros_utils.call_rosservice('/cabin/path_config',data)
    
    def emergency(self, status):
        """索驱紧急处理"""
        if status == 1:  # 紧急停止
            print("索驱急停")
            return self.ros_utils.call_rostopic('/forced_stop', 'Bool', 'data: True')
        elif status == 2:  # 暂停
            print("索驱暂停")
            return self.ros_utils.call_rostopic('/pause_interrupt', 'Bool', 'data: True')
        else:  # 恢复
            print("索驱恢复")
            return self.ros_utils.call_rostopic('/pause_interrupt', 'Bool', 'data: False')
        
    def setPlum(self,status):
        """设置梅花绑类型"""
        if status == 0:  # 全绑
            print("全绑")
            return self.ros_utils.call_rostopic('/send_odd_points', 'Int32', 'data: 0')
        elif status == 1:  # 单绑
            print("单绑")
            return self.ros_utils.call_rostopic('/send_odd_points', 'Int32', 'data: 1')
        elif status == 2:  # 双绑
            print("双绑")
            return self.ros_utils.call_rostopic('/send_odd_points', 'Int32', 'data: 2')